package com.jt.service;

import com.jt.mapper.RightsMapper;
import com.jt.pojo.Rights;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RightsServiceIMPL implements RightsService{
    @Autowired
    private RightsMapper rightsMapper;

    @Override
    public List<Rights> getRightsList() {
        int parentID= 0 ;
        List<Rights> onelist = rightsMapper.findParentByID(parentID);
        for (Rights oneRights : onelist){
            int oneId= oneRights.getId();
            List<Rights> twolist = rightsMapper.findParentByID(oneId);
            oneRights.setChildren(twolist);

    }
        return onelist;
}
}
